package com.probiz.estore.order.service.impl;

import com.probiz.estore.common.model.order.OrderPayment;
import com.probiz.estore.core.service.impl.GenericManagerImpl;
import com.probiz.estore.order.service.OrderPaymentManager;
import com.probiz.estore.order.dao.OrderPaymentDao;


/**
 * Manager implementation for OrderPayment, responsible for business processing, and communicate between web and persistence layer.
 */
public class OrderPaymentManagerImpl extends GenericManagerImpl<OrderPayment> implements OrderPaymentManager {

	private OrderPaymentDao orderPaymentDao = null;

	/**
	 * @param orderPaymentDao
	 *            the orderPaymentDao to set
	 */
	public void setOrderPaymentDao(OrderPaymentDao orderPaymentDao) {
		this.orderPaymentDao = orderPaymentDao;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#init()
	 */
	@Override
	protected void initManager() {
		dao = orderPaymentDao;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#preDelete(java.lang.Object)
	 */
	@Override
	protected void preDelete(OrderPayment entity) {

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#preSave(java.lang.Object)
	 */
	@Override
	protected void preSave(OrderPayment entity) {

	}
	/*
	 * (non-Javadoc)
	 * @see com.probiz.estore.order.service.OrderPaymentManager#getSizeByDocumentNo(java.lang.String)
	 */
	public Long getSizeByDocumentNo(String documentNo){
		return orderPaymentDao.countByHql("from OrderPayment o where o.documentNo = ?", documentNo);
	}

}
